//注册*
import {transfer} from "./axiosApi";

export function UserReg(username, password, phone, name) {
    return transfer({
        method: 'post',
        data: {username, password, phone, name},
        url: '/user/reg',
    })
} //修改用户可用状态*
export function UserLogin(username, password) {
    return transfer({
        url: '/user/login',
        params: {username, password},
    })
}

//获取当前登录状态
export function UserStatus(params) {
    return transfer({
        url: '/user/status',
        params
    })
}

//获取用户信息*
export function UserInfo(params) {
    return transfer(
        {
            url: '/user/info',
            params
        })
}

//修改当前用户信息*
export function EditUserInfo(phone, name) {
    return transfer({
        method: 'post',
        data: {phone, name},
        url: '/user/editUserInfo',
    })
}

//修改密码*
export function EditPassword(oldPass, newPass) {
    return transfer({
        params: {oldPass, newPass},
        url: '/user/editPassword',
    })
}

//登出*
export function UserLogout(params) {
    return transfer({
        url: '/user/logout',
        params
    })
}

//查询用户列表（分页）*
export function pageUser(data) {
    return transfer({
        method: 'post',
        data,
        url: '/user/a/page',
    })
}

export function editUserAvailable(userId) {
    return transfer({
        params: {userId},
        url: '/user/a/available',
    })
}